package org.domain.acount.session;

import java.util.HashMap;
import java.util.Map;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.framework.Controller;
import org.richfaces.component.state.TreeState;

@Name("treeStateController")
@Scope(ScopeType.SESSION)
@AutoCreate
public class TreeStateController extends Controller
{
    private Map<Integer, TreeState> treeStateMap = new HashMap<Integer, TreeState>();
    
    public TreeState getTreeState(Integer key)
    {
        TreeState treeState = treeStateMap.get(key); 
        if (treeState == null)
        {
            treeState = new TreeState();
            treeStateMap.put(key, treeState);
        }
        
        return treeState;
    }
    
    public void setTreeState(Integer key, TreeState treeState)
    {
        treeStateMap.put(key, treeState);
    }
}